// pages/huan_detail/huan_detail.js
var WxParse = require('../../../wxParse/wxParse.js');
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // 导航
    nav: {
      // nav_title
      nav_list: [{
        names: "jack",
        sex: "男",
        age: 18
      }],
    },
    danganArr: [{
      dizhi: "山西大医院",
      time: "2018-05-06",
      names: "李世民副主任医师",
      ke: "儿科-血液科",
      miaoshu: "士大夫就爱看风景雷克萨大吉来看撒娇发电量三了福建省立刻吉拉对方",
      jieguo: "士大夫就爱看风景雷克萨大吉来看撒娇发电量三了福建省立刻吉拉对方",
      imgArr: ["../../../images/active_01.jpg", "../../../images/active_02.jpg", "../../../images/active_03.jpg", "../../../images/active_01.jpg", "../../../images/active_02.jpg", "../../../images/active_03.jpg"]
    }],

    jiluArr: [{
      time: "29",
      time1: "四月",
      imgArr: ["../../../images/active_01.jpg", "../../../images/active_02.jpg", "../../../images/active_03.jpg", "../../../images/active_01.jpg", "../../../images/active_02.jpg", "../../../images/active_03.jpg"],
    }]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var that = this
    var id = options.id
    app.util.request({
      'url': 'entry/wxapp/Blxiangq',
      data: {
        id: id
      },
      success: function(res) {
        console.log(res)
        var uptime = res.data.data.uptime
        var str = (uptime).split(" ");
        var str2 = str[1].split("-");
        var str3 = str[0];
        var str4 = str3.split("-");
        var month = str4[1]
        var day = str4[2]
        if (month == '01') {
          var month1 = "一"
        }
        else if (month == '02') {
          var month1 = "二"
        }
        else if (month == '03') {
          var month1 = "三"
        }
        else if (month == '04') {
          var month1 = "四"
        }
        else if (month == '05') {
          var month1 = "五"
        }
        else if (month == '06') {
          var month1 = "六"
        }
        else if (month == '07') {
          var month1 = "七"
        }
        else if (month == '08') {
          var month1 = "八"
        }
        else if (month == '09') {
          var month1 = "九"
        }
        else if (month == '10') {
          var month1 = "十"
        }
        else if (month == '11') {
          var month1 = "十一"
        }
        else if (month == '12') {
          var month1 = "十二"
        }
        console.log(month, day)
        that.setData({
          blxiangq: res.data.data,
          month1: month1,
          day: day
        })
        WxParse.wxParse('articles', 'html', res.data.data.jida, that, 5);
      },
      fail: function(err) {
        console.log(err)
      },
    })

    app.util.request({
      'url': 'entry/wxapp/Base',
      success: function(res) {
        var se = res.data.data.ztcolor
        that.setData({
          baseinfo: res.data.data,
        })

      },
      fail: function(err) {
        console.log(err)
      },

    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})